package com.aaa.service.impl;


import com.aaa.dao.TbCheckTeacherDao;
import com.aaa.entity.CheckTeacher;
import com.aaa.entity.EduTeacher;
import com.aaa.vo.TbCheckTeacherVo;
import com.aaa.service.TbCheckTeacherService;


import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.eig.common.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 李双奇
 * @Date: 2022/12/13/21:10
 * @Description:
 */
@Service
public class TbCheckTeacherServiceImpl implements TbCheckTeacherService {

    @Autowired
    private TbCheckTeacherDao tbCheckTeacherDao;

    @Override
    public Result findCheckTeacherByPage(TbCheckTeacherVo tbCheckTeacherVo, Integer currentPage, Integer pageSize) {
        Integer current = (currentPage-1)*pageSize;
        List<CheckTeacher> byTeacherCheckPage = tbCheckTeacherDao.findByTeacherCheckPage(current, pageSize, tbCheckTeacherVo);
        System.out.println(byTeacherCheckPage.toString()+"----");
        Integer count = tbCheckTeacherDao.count(tbCheckTeacherVo);


        return new Result(2000,"查询成功",byTeacherCheckPage,Long.parseLong(count+""));
    }

    @Override
    public Result updataCheckTeacher(EduTeacher eduTeacher) {
        System.out.println(eduTeacher.getId()+"@@@@@@@@@@@@@@@@@@@@");
        return new Result(2000,"状态修改成功");
    }

    /**
     * 修改状态
     * @param eduTeacher
     * @return
     */
    @Override
    public Result updataStatus(EduTeacher eduTeacher) {
        UpdateWrapper<EduTeacher> wrapper = new UpdateWrapper<>();
        wrapper.eq("mobile" , eduTeacher.getMobile());
        wrapper.set("status",eduTeacher.getStatus());
        tbCheckTeacherDao.update(null,wrapper);
        return new Result(2000,"状态修改成功");
    }

    /**
     * 审核状态
     * @param checkTeacher
     * @return
     */
    @Override
    public Result updataTeacherCheckStatus(CheckTeacher checkTeacher) {
        System.out.println("checkTeacher = " + checkTeacher);
        return new Result(2000,"状态审核修改成功");
    }

}
